package com.meida.paotui.bus.provider.controller;

import com.meida.common.mybatis.model.*;
import com.meida.common.springmvc.base.BaseController;
import com.meida.paotui.bus.client.entity.BusWeightprice;
import com.meida.paotui.bus.provider.service.BusWeightpriceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;


/**
 * 重量价格表控制器
 *
 * @author flyme
 * @date 2019-11-12
 */
@RestController
@RequestMapping("/weightprice/")
public class BusWeightpriceController extends BaseController<BusWeightpriceService, BusWeightprice>  {

    @ApiOperation(value = "重量价格表-分页列表", notes = "重量价格表分页列表 <a href=\"#\" target='_blank'>参数说明</a>")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map map) {
        return bizService.pageList(map);
    }

    @ApiOperation(value = "重量价格表-列表", notes = "重量价格表列表 <a href=\"#\" target='_blank'>参数说明</a>")
    @GetMapping(value = "list")
    public ResultBody list(@ModelAttribute(value = "listModel") ListModel listModel) {
        return bizService.listEntityMap(listModel);
    }


    @ApiOperation(value = "重量价格表-添加", notes = "添加重量价格表")
    @PostMapping(value = "add")
    public ResultBody add(SaveModel model) {
        return bizService.add(model);
    }


    @ApiOperation(value = "重量价格表-更新", notes = "更新重量价格表")
    @PostMapping(value = "update")
    public ResultBody update(@ModelAttribute(value = "updateModel") UpdateModel updateModel) {
        return bizService.edit(updateModel);
    }

    @ApiOperation(value = "重量价格表-删除", notes = "删除重量价格表")
    @PostMapping(value = "remove")
    @ApiIgnore
    public ResultBody delete(@ModelAttribute(value = "deleteModel") DeleteModel deleteModel) {
        return bizService.delete(deleteModel);
    }


    @ApiOperation(value = "重量价格表-详情", notes = "重量价格表详情")
    @GetMapping(value = "get")
    public ResultBody get(@ModelAttribute(value = "getModel") GetModel getModel) {
        return bizService.get(getModel);
    }

    @ApiOperation(value = "重量价格表-更新状态值", notes = "重量价格表更新某个状态字段")
    @PostMapping(value = "setState")
    public ResultBody setState(@RequestParam(required = false) Map map, @RequestParam(value = "state") Integer state) {
        return bizService.setState(map, "state", state);
    }
}
